package com.tjnu.losca.core;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 统一异常处理
 * 加了@RestControll注解的错误都会往这里抛
 * @author Losca
 * @date 2021/9/16 12:48
 */
@RestControllerAdvice
public class MyException {
    @ExceptionHandler
    public ResponseVO myExceptionHandler(Exception ex){
        ex.printStackTrace();
        return ResponseVO.failed(ex.getMessage());
    }
}
